package com.mobile.persistent.entity;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.mobile.persistent.base.BaseEntity;

/**
 * @author qingqiu
 * 菜单权限表
 */
@Entity
@Table(name="purview")
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true)
public class Purview extends BaseEntity {
	private static final long serialVersionUID = 1L;

	/**
	 * 操作码(区分每个菜单及按钮)
	 */
	private String operCode;
	/**
	 * 父级操作码
	 */
	private String parentCode;
	private List<UserPurview> userPurviews;// 用户权限
	
	@Column(name="operCode", columnDefinition="varchar(10)")
	public String getOperCode() {
		return operCode;
	}
	public void setOperCode(String operCode) {
		this.operCode = operCode;
	}
	@Column(name="parentCode", columnDefinition="varchar(10)")
	public String getParentCode() {
		return parentCode;
	}
	public void setParentCode(String parentCode) {
		this.parentCode = parentCode;
	}
	@OneToMany(mappedBy="purview", fetch=FetchType.LAZY)
	@org.hibernate.annotations.Fetch(org.hibernate.annotations.FetchMode.SUBSELECT)
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE,
		org.hibernate.annotations.CascadeType.DELETE,
		org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
	public List<UserPurview> getUserPurviews() {
		return userPurviews;
	}
	public void setUserPurviews(List<UserPurview> userPurviews) {
		this.userPurviews = userPurviews;
	}
	
}
